package com.heima.article.controller.v1;


import com.heima.article.service.ApArticleService;
import com.heima.model.article.constant.ArticleConstant;
import com.heima.model.article.dto.ArticleHomeDto;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("app-article")
@RequestMapping("/api/v1/article")
@Api(tags = "app端首页文章接口")
public class ArticleHomeController {

    @Autowired
    private ApArticleService apArticleService;



    @PostMapping("/load")
    @ApiOperation("加载文章列表")
    public ResponseResult  load(@RequestBody ArticleHomeDto articleHomeDto) {
        return apArticleService.load(ArticleConstant.LOADTYPE_LOAD_MORE,articleHomeDto );

    }


    @PostMapping("/loadmore")
    public ResponseResult loadMore(@RequestBody ArticleHomeDto dto) {


        return  apArticleService.load(ArticleConstant.LOADTYPE_LOAD_MORE,dto);
    }

    @PostMapping("/loadnew")
    public ResponseResult loadNew(@RequestBody ArticleHomeDto dto) {

        return apArticleService.load(ArticleConstant.LOADTYPE_LOAD_NEW,dto);
    }
}
